import request from '@/utils/request'
import qs from 'qs'

/**
 * =====================菜品类型模块======================
 */

// 获取菜品类型
export function findFoodType () {
  return request({
    url: '/food/food_type/select_item',
    method: 'get',
    params: {
      storeId: sessionStorage.getItem('storeId')
    }
  })
}

/**
 * 添加菜品类型
 */
export function addFoodType (name) {
  return request({
    url: '/food/food_type/save',
    method: 'post',
    data: qs.stringify({
      storeId: sessionStorage.getItem('storeId'),
      name
    })
  })
}

/**
 * 修改菜品类型
 */
export function editFoodType (id, name) {
  return request({
    url: '/food/food_type/update',
    method: 'post',
    data: qs.stringify({
      id,
      name
    })
  })
}

/**
 * 删除菜品类型
 */
export function deleteFoodType (foodTypeDetailId) {
  return request({
    url: '/food/food_type/delete',
    method: 'post',
    data: qs.stringify({
      ids: foodTypeDetailId
    })
  })
}

